<%--
  Created by IntelliJ IDEA.
  User: Peter Zhou
 
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>头部导航栏</title>
</head>
<body>
<!--这里是导航栏-->
<ul class="nav  border-bottom fixed-top "   role="tablist">
    <li class="nav-item">
        <a class="nav-link " data-bs-toggle="pill" href="#home"><img class="img-fluid rounded" width="16px" height="16px" src="img/logo.png">服装购买系统</a>
    </li>
    <li class="nav-item float-start"  >
        <a class="nav-link"  href="index.jsp" >首页</a>
    </li>
    <li class="nav-item dropdown ">
        <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">个人管理</a>
        <div class="dropdown-menu">
            <%if(session.getAttribute("user")==null){%>
            <a class="dropdown-item" href="login.jsp">登录</a>
            <a class="dropdown-item" href="signup.jsp">注册</a><%}else{%>
            <a class="dropdown-item" href="login-out">退出登录</a>
            <a class="dropdown-item" href="userInfo.jsp">个人信息修改</a>
            <%}%>
        </div>

    </li>
    <li class="nav-item">
<%--购物车消息提示--%>
<%--        如果没有创建application域对象cartItemNum或其为0则不显示徽章--%>
        <%if(application.getAttribute("cartItemNum") == null ||
                (application.getAttribute("cartItemNum")).equals(0)){%>
        <a class="nav-link"  href="shoppingCar.jsp"><img class="img-fluid rounded" width="16px" height="16px" src="img/shoppingCar1.png">购物车</a>
         <%}else{%>
<%--    否则显示徽章其数字为application域对象cartItemNum的值--%>
            <a class="nav-link"  href="shoppingCar.jsp">
                <img class="img-fluid rounded" width="16px" height="16px" src="img/shoppingCar1.png">购物车<span class="badge rounded-pill bg-danger"><%=application.getAttribute("cartItemNum")%>
        </span></a><%}%>
    </li>
    <li class="nav-item">
        <a class="nav-link"  href="order.jsp">我的订单</a>
    </li>
</ul>
</body>
</html>
